# Bootloader
TARGET_BOOTLOADER_BOARD_NAME := Xplay5S
TARGET_NO_BOOTLOADER := true

# Platform
TARGET_BOARD_PLATFORM := msm8996
#TARGET_BOARD_PLATFORM_GPU := qcom-adreno530
TARGET_PLATFORM_DEVICE_BASE := /devices/soc.0/

# Flags
TARGET_GLOBAL_CFLAGS += -mfpu=neon -mfloat-abi=softfp
TARGET_GLOBAL_CPPFLAGS += -mfpu=neon -mfloat-abi=softfp
COMMON_GLOBAL_CFLAGS += -DREFRESH_RATE=60  

# Architecture
TARGET_ARCH := arm64
TARGET_ARCH_VARIANT := armv8-a
TARGET_CPU_ABI := arm64-v8a
TARGET_CPU_ABI2 :=
TARGET_CPU_VARIANT := kryo
TARGET_CPU_SMP := true

TARGET_2ND_ARCH := arm
TARGET_2ND_ARCH_VARIANT := armv7-a-neon
TARGET_2ND_CPU_ABI := armeabi-v7a
TARGET_2ND_CPU_ABI2 := armeabi
TARGET_2ND_CPU_VARIANT := generic

BOARD_KERNEL_CMDLINE := console=ttyHSL0,115200,n8 androidboot.console=null androidboot.hardware=qcom user_debug=31 msm_rtb.filter=0x237 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 cma=16M@0-0xffffffff product.version=PD1516A_A_1.17.5 androidboot.securebootkey=alpha androidboot.securebootkeyhash=60ba997fef6da9f05885fa11f1dd6d2a90d052a257a09c2075d7246cc73c0d43 androidboot.securebootkeyver=1
                                                
BOARD_KERNEL_BASE := 0x80000000
BOARD_KERNEL_PAGESIZE := 4096
BOARD_KERNEL_OFFSET = 0x00008000 
BOARD_RAMDISK_OFFSET = 0x01000000
BOARD_TAGS_OFFSET = 0x00000100 
BOARD_MKBOOTIMG_ARGS := --kernel_offset $(BOARD_KERNEL_OFFSET) --ramdisk_offset $(BOARD_RAMDISK_OFFSET) --tags_offset $(BOARD_TAGS_OFFSET) --board Xplay5S
#TARGET_USES_UNCOMPRESSED_KERNEL := false
TARGET_KERNEL_APPEND_DTB := true
BOARD_KERNEL_IMAGE_NAME := device/vivo/Xplay5S/kernel

# prebuilt kernel
TARGET_PREBUILT_KERNEL := device/vivo/Xplay5S/kernel
# else uncomment below to build from sauce
#TARGET_KERNEL_SOURCE := kernel/vivo/Xplay5S
#TARGET_KERNEL_CONFIG := cyanogenmod_Xplay5S_defconfig

TARGET_USE_MDTP := true 
BOARD_BOOTIMAGE_PARTITION_SIZE := 0x4000000        #64MB
BOARD_RECOVERYIMAGE_PARTITION_SIZE := 0x4000000    #64MB
BOARD_SYSTEMIMAGE_PARTITION_SIZE := 0xC0000000   #3GB
BOARD_USERDATAIMAGE_PARTITION_SIZE := 0x1CAF9B3000 #114.7GB
BOARD_FLASH_BLOCK_SIZE := 131072 # (BOARD_KERNEL_PAGESIZE * 64)
BOARD_VOLD_EMMC_SHARES_DEV_MAJOR := true

TARGET_RECOVERY_FSTAB := device/vivo/Xplay5S/twrp.fstab

TARGET_USERIMAGES_USE_EXT4 := true
#TARGET_USERIMAGES_USE_F2FS := true
BOARD_HAS_NO_SELECT_BUTTON := true
TARGET_RECOVERY_PIXEL_FORMAT := "RGB_565"

TW_THEME := portrait_hdpi
RECOVERY_GRAPHICS_USE_LINELENGTH := true
#TW_INCLUDE_CRYPTO := true
TW_NO_USB_STORAGE := true
BOARD_SUPPRESS_SECURE_ERASE := true
RECOVERY_SDCARD_ON_DATA := true
BOARD_HAS_NO_REAL_SDCARD := true
TW_INPUT_BLACKLIST := "accelerometer"
TW_BRIGHTNESS_PATH := "/sys/class/leds/lcd-backlight/brightness"
TW_IGNORE_ABS_MT_TRACKING_ID := true
#flip buffer 180 degrees for devices with physicaly inverted screens
#BOARD_HAS_FLIPPED_SCREEN := true  
#TW_TARGET_USES_QCOM_BSP := true
#TARGET_CUSTOM_KERNEL_HEADERS := device/vivo/Xplay5S/include
#TW_NEW_ION_HEAP := true